package com.hrpmar.controller;

import com.hrpmar.pojo.Destorydetails;
import com.hrpmar.pojo.Purdetails;
import com.hrpmar.pojo.Purplan;
import com.hrpmar.service.AuditService;
import com.hrpmar.service.DrugstockService;
import com.hrpmar.service.PurplanService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created by c on 2017-11-21.
 */
@Controller
@RequestMapping("/audit")
public class AuditController {

    @Resource
    private PurplanService purplanService;
    @Resource
    private AuditService auditService;
    @Resource
    private DrugstockService drugstockService;

    @GetMapping("searchdetails")
    public String searchDetails(String desNum,Model model){

        List<Destorydetails> list = drugstockService.searchDestoryDetailsSee(desNum);
        model.addAttribute("listDetails",list);
        return "audit/plandetails";
    }


    @RequestMapping("/searchOne")
    public String searchPurplan(String planNum, Model model){
        Purplan pur = purplanService.searchPurplanByNum(planNum);
        List<Purdetails> list = purplanService.searchDetails(planNum);
        model.addAttribute("pur",pur);
        model.addAttribute("list",list);
        return "audit/auditdetail";
    }

}
